<template>
  <div class="not-found-container">
    <div class="not-found-content">
      <div class="error-number">404</div>
      <h1>页面未找到</h1>
      <p>抱歉，你访问的页面不存在或已被移除</p>
      <div class="error-image">🗺️</div>
      <div class="error-links">
        <router-link to="/" class="home-link">返回首页</router-link>
        <router-link to="/questions" class="questions-link">浏览情感问题</router-link>
      </div>
      <div class="search-suggestion">
        <p>或者尝试搜索相关内容：</p>
        <div class="search-box">
          <input type="text" v-model="searchQuery" placeholder="输入关键词搜索..." class="search-input">
          <button @click="performSearch" class="search-btn">搜索</button>
        </div>
      </div>
      <div class="suggestions">
        <h3>热门话题</h3>
        <div class="topic-tags">
          <span v-for="topic in hotTopics" :key="topic" class="topic-tag" @click="searchTopic(topic)">{{ topic }}</span>
        </div>
      </div>
      <div class="error-message">
        <p>如果你认为这是一个错误，请联系我们的客服：</p>
        <p class="contact-email">support@ganqingjieyou.com</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NotFoundView',
  data() {
    return {
      searchQuery: '',
     hotTopics: [
        '爱情困扰',
        '分手挽回',
        '暗恋表白',
        '婚姻关系',
        '友情维护',
        '家庭矛盾',
        '自我成长'
      ]
    }
  },
  methods: {
    performSearch() {
      if (this.searchQuery.trim()) {
        // 这里可以添加实际的搜索逻辑
        alert(`搜索：${this.searchQuery}`);
        // 例如：this.$router.push({ path: '/search', query: { q: this.searchQuery } });
      }
    },
    searchTopic(topic) {
      this.searchQuery = topic;
      this.performSearch();
    }
  }
}
</script>

<style scoped>
.not-found-container {
  width: 100%;
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.not-found-content {
  max-width: 600px;
  width: 100%;
  background-color: #fff;
  border-radius: 15px;
  padding: 3rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.error-number {
  font-size: 7rem;
  font-weight: 700;
  color: #ff9a9e;
  margin-bottom: 1rem;
  letter-spacing: -5px;
}

.not-found-content h1 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 1rem;
}

.not-found-content p {
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.error-image {
  font-size: 8rem;
  margin-bottom: 2rem;
  opacity: 0.7;
}

.error-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 2rem;
}

.home-link,
.questions-link {
  text-decoration: none;
  padding: 0.8rem 2rem;
  border-radius: 25px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.home-link {
  background-color: #ff9a9e;
  color: #fff;
}

.home-link:hover {
  background-color: #f86d75;
  transform: translateY(-2px);
}

.questions-link {
  background-color: #fff;
  color: #ff9a9e;
  border: 2px solid #ff9a9e;
}

.questions-link:hover {
  background-color: #ff9a9e;
  color: #fff;
  transform: translateY(-2px);
}

.search-suggestion {
  margin-bottom: 2rem;
}

.search-suggestion p {
  margin-bottom: 1rem;
}

.search-box {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.search-input {
  padding: 0.8rem 1rem;
  border: 2px solid #ddd;
  border-radius: 25px;
  width: 100%;
  max-width: 300px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: #ff9a9e;
}

.search-btn {
  padding: 0.8rem 1.5rem;
  background-color: #ff9a9e;
  color: #fff;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.search-btn:hover {
  background-color: #f86d75;
  transform: translateY(-2px);
}

.suggestions {
  margin-bottom: 2rem;
}

.suggestions h3 {
  color: #333;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.topic-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.topic-tag {
  padding: 0.5rem 1rem;
  background-color: #f8f9fa;
  border-radius: 25px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9rem;
}

.topic-tag:hover {
  background-color: #ff9a9e;
  color: #fff;
}

.error-message {
  padding: 1.5rem;
  background-color: #f8f9fa;
  border-radius: 10px;
  text-align: left;
}

.error-message p {
  margin-bottom: 0.5rem;
}

.error-message p:last-child {
  margin-bottom: 0;
  color: #ff9a9e;
  font-weight: bold;
}

@media (max-width: 768px) {
  .not-found-container {
    padding: 1rem;
  }
  
  .not-found-content {
    padding: 2rem 1rem;
  }
  
  .error-number {
    font-size: 5rem;
  }
  
  .not-found-content h1 {
    font-size: 2rem;
  }
  
  .error-image {
    font-size: 5rem;
  }
  
  .error-links {
    flex-direction: column;
  }
  
  .search-box {
    flex-direction: column;
    align-items: center;
  }
  
  .search-input {
    max-width: 100%;
  }
  
  .search-btn {
    width: 100%;
    max-width: 300px;
  }
}
</style>